const $axios = require("w-vue-middle/api/axios").default;

/**
 * @Author: Jason Liu
 * @description: 采集内容数据
 */
export function collectionDataInfo(params = {
  clusterId: undefined, //集群ID
  collectType: 'schema', // 采集类型：schema、table、column
  dsId: undefined,
  schema: undefined,
  tableName: undefined
}) {

  return $axios({
    url: `${appService.dataIntegration}/api/v1/MetaData/realtime/job`,
    method: 'post',
    data: params
  })
}
/**
 * @Author: Jason Liu
 * @description: 获取集群信息
 */
export function getClusterManager(params = {
  pageNum: 1,
  pageSize: 15,
  queryParams: {}
}) {
  return $axios({
      url: `${appService.dataIntegration}/api/v1/dfDiClusterManager/list`,
      method: 'post',
      data: params
  })
}

/**
 * @Author: Jason Liu
 * @description:获取sql函数
 */
//sql函数缓存变量
let sqlFunctonList = [];
export function getSQlFunctonList() {
  if (sqlFunctonList.length > 0) {
      return new Promise((resolve, reject) => {
          resolve({
              data: sqlFunctonList
          })
      });
  } else {
      return $axios({
          url: `${appService.dataIntegration}/api/v1/dfDiSys/listGroup`,
          method: 'post'
      }).then(req => {
          sqlFunctonList = req.data

          return req;
      })
  }
}
/**
 * @Author: Jason Liu
 * @description: 启动测试流程
 */
export function runJobTest(param) {
  return $axios({
      url: `${appService.dataIntegration}/api/v1/jobExecution/testJob`,
      method: 'post',
      data: param
  })

}

/**
 * @Author: l_nn
 * @description: 库表输出-内容设置-值域映射
 */
export function queryDomainList(params = {}) {
  return $axios({
    url: `${$service.dataIntegration}/api/v1/valueMapping/queryDomainList`,
    method: 'get',
    params: params,
  });
}

/**
 * @Author: Jason Liu
 * @description:获取医疗机构信息
 */
export function getValueMappingQueryOrg(params) {
  return $axios({
    url: `${appService.dataIntegration}/api/v1/valueMapping/queryOrg`,
    method: 'get',
    params: params,
  });
}

/**
 * @Author: l_nn
 * @description: 获取系统
 */
export function queryPlat(params = {}) {
  return $axios({
    url: `${$service.dataIntegration}/api/v1/valueMapping/queryPlat`,
    method: 'get',
    params: params,
  });
}

/**
 * @Author: l_nn
 * @description: 获取值域
 */
export function queryPlatDomain(params = {}) {
  return $axios({
    url: `${$service.dataIntegration}/api/v1/valueMapping/queryPlatDomain`,
    method: 'get',
    params: params,
  });
}

/**
 * @Author: l_nn
 * @description: 获取值域类别
 */
export function queryValueMappingMeta(params = {}) {
  return $axios({
    url: `${$service.dataIntegration}/api/v1/valueMapping/queryValueMappingMeta`,
    method: 'get',
    params: params,
  });
}


/**
 * @Author: y_zp
 * @description: 调度模型列表
 */
export function getHdwCustomizeTables(params = {}) {
  return $axios({
    url: `${$service.dataIntegration}/api/v1/dtJob/getHdwCustomizeTables`,
    method: 'post',
    data: params
  });
}

/**
 * @Author: y_zp
 * @description: 根据调度模型获取信息
 */
export function getHdwTableJob(params = {}) {
  return $axios({
    url: `${$service.dataIntegration}/api/v1/dtJob/getJob`,
    method: 'post',
    data: params
  });
}

/**
 * @Author: y_zp
 * @description: 新增时获取转换的id
 */
export function getTransferNewId() {
  return $axios({
    url: `${$service.dataIntegration}/api/v1/dtJob/getId`,
    method: 'get',
  });
}

/**
 * @Author: y_zp
 * @description: 集成调度保存
 */
export function saveScheduleTransfer(params = {}) {
  return $axios({
    url: `${$service.dataIntegration}/api/v1/dtJob/save`,
    method: 'post',
    data: params
  });
}
/**
 * @Author: y_zp
 * @description: 集成调度列表
 */
export function getDtJobList(params = {}) {
  return $axios({
    url: `${$service.dataIntegration}/api/v1/dtJob/pagedList`,
    method: 'post',
    data: params
  });
}
/**
 * @Author: y_zp
 * @description: 集成调度列表删除
 */
export function deleteTransferJob(params = {}) {
  return $axios({
    url: `${$service.dataIntegration}/api/v1/dtJob/deleteTransferJob`,
    method: 'post',
    data: params
  });
}

/**
 * @Author: y_zp
 * @description: 通过集成作业获取自定义hdw 信息
 */
export function getHdwInfoByJob(params = {}) {
  return $axios({
    url: `${$service.dataIntegration}/api/v1/dtJob/getHdwInfoByJob`,
    method: 'post',
    data: params
  });
}
